<template>
  <!-- 面包屑导航区域 -->
  <breadcrumb :childMenu="['权限管理', '权限列表']"></breadcrumb>
  <!-- 卡片视图 -->
  <el-card>
    <el-table :data="menuList" border stripe size="mini">
      <el-table-column label="序号" type="index"></el-table-column>
      <el-table-column label="权限名称" prop="authName"></el-table-column>
      <el-table-column label="路径" prop="path"></el-table-column>
      <el-table-column label="权限等级" prop="level">
        <template v-slot="scope">
          <el-tag v-if="scope.row.level === 0">一级</el-tag>
          <el-tag v-if="scope.row.level === 1" type="success">二级</el-tag>
          <el-tag v-if="scope.row.level === 2" type="warning">三级</el-tag>
        </template>
      </el-table-column>
    </el-table>
  </el-card>
</template>

<script>
import Breadcrumb from "@/common/Breadcrumb.vue";
import { getMenus } from "network/permissions.js";
export default {
  components: {
    Breadcrumb
  },
  data() {
    return {
      menuList: []
    };
  },
  created() {
    this.getPermissions();
  },
  methods: {
    async getPermissions() {
      const res = await getMenus("list");
      if (!res.success)
        return this.$message.error({ showClose: true, message: data.msg });
      this.menuList = res.response;
      // console.log(this.menuList);
    }
  }
};
</script>

<style lang="less" scoped></style>
